#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 5013

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["netcore_gateway.csproj", "./"]
RUN dotnet restore "netcore_gateway.csproj"
COPY . .
WORKDIR "/src"
RUN dotnet build "netcore_gateway.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "netcore_gateway.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

ENTRYPOINT ["dotnet", "netcore_gateway.dll"]